/********************************************************************************
 * Copyright (c)2016-2020, ShenZhen WanJiaAn Technology CO.,LTD.
 * All Rights Reserved.
 *
 * File Name     : partition_table.h
 * Author        : joki.zhu
 * Date          : 2019-10-30
 *
 * Record        :
 * 1.Date        : 2019-10-30
 *   Author      : joki.zhu
 *   Modification: Created file
 ********************************************************************************/

#ifndef __PARTITION_TABLE_H__
#define __PARTITION_TABLE_H__


#ifdef __cplusplus
#if __cplusplus
extern "C"{
#endif
#endif /* __cplusplus */



/********************************* Partition table info *************************************/
#define FLASH_TOTAL_SIZE            (0x1000000)

#ifdef YD_PROTOCOL
#define FLASH_UBOOT_OFFSET          (0x0000000)
#define FLASH_UBOOT_SIZE            (0x0100000) //1M
#define FLASH_APP_OFFSET            (FLASH_UBOOT_OFFSET + FLASH_UBOOT_SIZE)
#define FLASH_APP_SIZE              (0x0700000) //7M
#define FLASH_RES_OFFSET            (FLASH_APP_OFFSET + FLASH_APP_SIZE)
#define FLASH_RES_SIZE              (0x0300000) //3M
#define FLASH_RECOVERY_OFFSET       (FLASH_RES_OFFSET + FLASH_RES_SIZE)
#define FLASH_RECOVERY_SIZE         (0x0300000) //3M
#define FLASH_RESERVED_OFFSET       (FLASH_RECOVERY_OFFSET + FLASH_RECOVERY_SIZE)
#define FLASH_RESERVED_SIZE         (0x00E0000) //896K 预留分区
#define FLASH_CONFIG_OFFSET         (FLASH_RESERVED_OFFSET + FLASH_RESERVED_SIZE)
#define FLASH_CONFIG_SIZE           (0x0100000) //1M
#define FLASH_WIFIBAK_OFFSET        (FLASH_CONFIG_OFFSET + FLASH_CONFIG_SIZE)
#define FLASH_WIFIBAK_SIZE          (0x0020000) //128K
#else
#define FLASH_UBOOT_OFFSET          (0x0000000)
#define FLASH_UBOOT_SIZE            (0x0100000) //1M
#define FLASH_APP_OFFSET            (FLASH_UBOOT_OFFSET + FLASH_UBOOT_SIZE)
#define FLASH_APP_SIZE              (0x0700000) //7M
#define FLASH_RES_OFFSET            (FLASH_APP_OFFSET + FLASH_APP_SIZE)
#define FLASH_RES_SIZE              (0x0300000) //3M
#define FLASH_RECOVERY_OFFSET       (FLASH_RES_OFFSET + FLASH_RES_SIZE)
#define FLASH_RECOVERY_SIZE         (0x0300000) //3M
#define FLASH_RESERVED_OFFSET       (FLASH_RECOVERY_OFFSET + FLASH_RECOVERY_SIZE)
#define FLASH_RESERVED_SIZE         (0x00E0000) //896K 预留分区
#define FLASH_CONFIG_OFFSET         (FLASH_RESERVED_OFFSET + FLASH_RESERVED_SIZE)
#define FLASH_CONFIG_SIZE           (0x0100000) //1M
#define FLASH_WIFIBAK_OFFSET        (FLASH_CONFIG_OFFSET + FLASH_CONFIG_SIZE)
#define FLASH_WIFIBAK_SIZE          (0x0020000) //128K

#endif /* YD_PROTOCOL */

/********************************* Partition image name *************************************/
#define IMAGE_UBOOT_FILE_NAME		"uboot.bin"
#define IMAGE_IPCAM_FILE_NAME		"ipcam.bin.zip"
#define IMAGE_RES_FILE_NAME			"res.jffs2"
#define IMAGE_RECOVERY_FILE_NAME	"recovery.bin"
#define IMAGE_RESERVED_FILE_NAME	"reserved"
#define IMAGE_CONFIG_FILE_NAME		"config.jffs2"
#define IMAGE_WIFIBAK_FILE_NAME		"wifibak"


/*********************************************************************************************/
#define FLASH_RES_DIR                "/res"
#define FLASH_CONFIG_DIR             "/config"

/*********************************************************************************************/

#ifdef __cplusplus
#if __cplusplus
}
#endif
#endif /* __cplusplus */


#endif /* __PARTITION_TABLE_H__ */
